
/**
 * name:        弹窗
 * author:      wuwq & lyj
 * Time:        18/01/26
 * Copyright:   bgemall.com
 */

//  弹窗
function tc(msg){
    var str='<div class="popover"></div>';
    $('body').append(str);
    var height=$('.popover').height();
    $('.popover').css('margin-top',-(height/2))
    if(height>'40'){
        $('.popover').css({
            'margin-top':-(height/2),
            'line-height':'30px',
        })
    }
    $(".popover").text(msg);
    setTimeout(function(){
        $('.popover').remove();
    },1000);
};
// 正在开发中
function kf(){
    var str1='<div class="popover_02"></div>';
    $('body').append(str1);
    var height=$('.popover_02').height();
    $('.popover_02').css('margin-top',-(height/2))
    if(height>'40'){
        $('.popover_02').css({
            'margin-top':-(height/2),
            'line-height':'30px',
        })
    }
    var picObj='<img src="../img/base/kaifa.gif">';
    $(".popover_02").html(picObj);
    setTimeout(function(){
        $('.popover_02').remove();
    },3000);
}
function con(){
var con=''
con+='<div class="confirm_bg"></div>'
con+='<div class="confirm">'
con+='<h1>确认要删除该商品？</h1>'
con+='<span class="fl confirm_butt">确定</span>'
con+='<span class="fr cancel_butt">取消</span>'
con+='</div>'
$('body').append(con)
}
//返回顶部
$(function(){
    $('body').append('<a style="display:none" class="to_top"></a>')
    
    setTimeout(function(){
        var bott=$('.mod_foot').height()
        $(window).scroll(function(){
        　　var scrollTop = $(this).scrollTop();
        　　var scrollHeight = $(document).height();
        　　var windowHeight = $(this).height();
            var padding_top=parseInt($('.mod_foot').css('padding-top'))*2
            if($(window).scrollTop() > windowHeight/2){
                $(".to_top").show();
            }
            else{
                $(".to_top").hide(); 
            } 
        　　if(scrollTop + windowHeight >= scrollHeight-bott){
            　　　　$(".to_top").css({
                        'bottom':bott+padding_top+'px',
                        'transition':'all 0.2s'
                    })
            　　}
            else{
                $(".to_top").css({
                    'bottom':'100px',
                    'transition':'all 0.2s'
                })
            }
        });
        $('.to_top').click(function(){
            $('body,html').animate({scrollTop: 0}, 300);
        })
    },300)
})

